Alfie Elliott's profile

CT4105 – 2D Platformer Tutorial Level

CT4105 – 2D Platformer Tutorial Level
Begining a game development project always begins in the documentation, developing an idea before jumping in is important to plan ahead to avoid falling into the common pittfalls of an unstructured workflow; deviating from the original idea and creeping in features early in development are a sure way for a project to become bloated, uncoordinated and muddled. When a project has an achievable and actionable plan, it is easier to implement features in an expandable and organized way and tracking development accuratley to make sure you achieve your goals for the project.
Ideation
For my project, I was inspired by games like Celeste (2018), Hyperlight Drifter (2016), and Hollow Knight (2017), these games and others like it guided me aesthetically and in terms of design. 
I have been using a website called Milanote to plan my project, establishing the themes and inspirations I have drawn from, and discuss possible features that I want to include in my project.
Character Controller & Animations
I made this piece of concept material using As to show what the environment of my game would look like once its complete and in engine, and I reused the ground i made to create a tile set that is ready to use in Unity using the Unity2D tile editor.
Next I worked on a script using a temporary set of player sprites, to get the player moving around on the terrain I made using the RigidBody2D component, the jump script allows the player to extend their jump by holding the jump input. 
The double capsule collider is to prevent the player sticking to walls, a shorter slightly winder collider protrudes on both sides with a slippery physic material to make sure the player cant stick to surfaces. I used an OverlapCircle to check for the ground as I find that this produces more consistent results compared to raycasts, especially when the player is on a slope or on a ledge.
I created a basic Animator to handle the players animations, with a submachine that handles the players air movement, when the player jumps it will play the falling animation following the jump animation, but it will also play it when falling off a ledge.
Respawning & Deathbox
Next I decieded to add a basic respawning system so that I wouldnt have to restart the player every time I fell down a pitfall, the current respawn point is stored inside of a singleton GameManager script, when the player falls into one of the DeathBox triggers, the player is moved to the position of the current active checkpoint. 
Somtimes errors can occur while setting the position of a GameObject while it has a simulating RigidBody2D component, to avoid this you can briefly make it kinematic while you adjust its position.
Health & Damage
Starting work on my games health and damage system, I created a PlayerManager script, which tracks things such as the players health, this script inherits from the IDamagable and IHealable interfaces, which allows me to easily apply damage to the player and heal the player from other scripts. The health is tracked by the hearts shown in the top left of the screen. 
The invulnerability frames make it so the player doesn't get hit too many times, this could result in the player taking too much damage than anticipated or taking damage too quickly. This is handled in a coroutine that is started when the player is hit. 
The healthbar and heart assets are created when the CreateHealthbar method is called, which is primarily when the game starts. The amount of hearts shown is dependant on the players maximum health pool, allowing this to be adjusted very easily. The health bar can be refreshed when the player gets hit, this iterates through the maxHealth of the player, and changes the hearts to empty if it goes over the players currentHealth. 
Creating The Player
I had some inital thoughts for the character in mind, they had to be simple and fit in with the theme, maybe some adventurer elements but also a combatitive quality, this was my first attempt:
I didn't really like this inital design, I felt like it was too over-developed in the wrong places, but there were some parts I liked, I took everything I liked about it and started again from fresh, and this was my second design:
I much prefer this second design, I feel like the proportions are a lot better for a character of this size, and it had much more personality. With my character done, it was time to create some animations to replace my old ones, namely the running and idle animations. 
On the left is the running animation and on the right is the idle animation which is slowed down a lot in the unity Editor, I used the first frames of the jumping animation and various parts of the frames to make a jumping and landing animation inside Unity.
I used the unity animator to pace my animation frames, and used scaling box to some squash and stretch the the sprite, I think this gives it a really bouncy, energetic look and helps accentuate the animations at a low resolution. 
Background
First I took the background from my original concept and split it into 3 parts, making sure it tiled correctly on either side.
Statically following the player, the background seemed to lack any sense of depth and blended in with the foreground. With help from a Code Monkey tutorial, I was able to add these background layers into my scene with a parallax effect, this made my games environment feel much more believable.
Falling & Moving Platforms
To add more variety to the platforming experience, I decided to add some staple features, moving and falling platforms.
The fall coroutine starts when the player collides with the platform, it also checks to make sure the player is above the platform before starting it, so if the player jumps through the bottom of it, it won't begin until they are standing on it and above it.
Originally the animation controlled the alpha of the platform and it faded out, but I didnt really like how it looked, so instead I used a custom sprite shader to add a dither effect which is controlled by an animation, I think this looks much better, and more consistent with the style.
The moving platform moves between different points on its path, points can be added and removed from the inspection menu, and a gizmo draws a line between all the points to show how it moves between them.
I wanted these elements to look out of place and mysterious because they move unnaturally. Their grey slated appearance and blue crystal motif adds an element of strangness to them that explains how they work.
Interactables
Using the Unity Events system, I was able to include various buttons and triggers in my level that can interact with certain elements of the level, in this case I used to to create a door that is raised when a button is pushed. All interactable objects inherit from the "IInteractable" interface which allows me to easily specify what objects the player can interact with.
According to the brief I had to add some sort of NPC to the game, and while it isnt a regular character, I decided to add the research base I produced in my concept, as well as a computer that the player can enter a dialogue with, I adpated the provided dialogue scripts to use more modular scriptable objects, which can be placed in any NPCManger to give them dialogue, I can even specify things like the font style per sentence.
More dangers
The player will now be faced with more challenges, including floating crystals which will hit you away and lasers which will shoot at the player, I added these because I thought there wasn't enough diversity in the gameplay, and the player wasnt under enough threat.
Although combat is something I initially thought would be important, I reconsidered this when I began the production process, as it would have been a large undertaking and I would have had to dedicate a large part of my production to that rather than other key features which were a part of the brief, but if I had more time or wanted to take this further it is something I would definitley add.
Menus & Transitions
I used Unity UI System to create the start menu and in-game HUD. The onscreen controls use components from Unity's new input system to convert button presses on the screen to gamepad controls to influence the character. Creating the input like this means that the input actually works on all platforms.
I used Unity's new task system and shader graph to create this circle transition effect, the script stays between scenes so the transition can be completed, and it won't transition until the scene is loaded.
I also added a level complete menu, which shows how much score you got as well as the time it took you to finish the level as well as a rank that is granted depending on the percentage of the total score in that level.
Sound
When creating the soundscape of my game I was immediatley struck with how hard it is to find sound clips online without a budget. Most of my clips came from a GDC archive which contains huge amounts of free to use sounds. If I couldn't find a sound in the archive that suited my situation, I would look elsewhere or try and record them myself. I added triggers in the cave areas that add reverb to the audio, I think this adds some depth.
When it came to music I couldn't really find anything that I liked, when a piece of music would loop for the whole level I would find it pretty overwhelming and annoying so I chose just to add some subtle ambient sound instead. I would love to add music but it's not something I can produce or find easily.
Designing the level
When I first started thinking about the level I struggled to imagine what it would look like until I introduced the player, and created the obstacles they could face. This help me put together segments I thought were interesting, and I spent a lot of time experimenting with what worked and what doesn't. I think adding the second cave tile pallete helped visually break it up.
Conclusion
In conclusion im happy with what I have produced and I had fun producing all the elements and by challenging myself I have learnt much more about Unity and sprite creation. If I had more time I think combat would be one thing that I would add, but as it stands that would be too much of an undertaking for this particular assignment.
Bibliography
- CodeMonkey (2020) Parallax Infinite Scrolling Background in Unity. Available athttps://www.youtube.com/watch?v=wBol2xzxCOU(Accessed: 17th December 2022)
-  Celeste (standard edition). 2018. Nintedo Switch[Game]. Maddy Makes Games
-  Hollow Knight (standard edition). 2017. PC[Game]. Team Cherry
-  Hyper Light Drifter (standard edition). 2016. PC[Game]. Annapurna Interactive
CT4105 – 2D Platformer Tutorial Level
Published:

Owner

CT4105 – 2D Platformer Tutorial Level

Published: